package com.gitee.urick.union.model;

import com.power.doc.model.ApiDoc;
import com.power.doc.model.ApiMethodDoc;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * @author Rick 2021/02/08
 * @since 1.0
 */
public class UnionApiDocGroup extends ApiDoc {
    private int subOrder;
    private boolean isDefaultGroup;
    private List<UnionApiDocGroup> children;

    public UnionApiDocGroup() {
    }


    public UnionApiDocGroup(boolean isDefaultGroup) {
        this.isDefaultGroup = isDefaultGroup;
    }


    public int getSubOrder() {
        return subOrder;
    }

    public void setSubOrder(int subOrder) {
        this.subOrder = subOrder;
    }

    public boolean isDefaultGroup() {
        return isDefaultGroup;
    }

    public void setDefaultGroup(boolean defaultGroup) {
        isDefaultGroup = defaultGroup;
    }

    public List<UnionApiDocGroup> getChildren() {
        return children;
    }

    public void setChildren(List<UnionApiDocGroup> children) {
        this.children = children;
    }

    public void addChildren(UnionApiDocGroup group){
        if(children==null) children = new ArrayList<>();
        children.add(group);
    }

    public void addListItem(ApiMethodDoc apiMethodDoc) {
        if(super.getList()==null) super.setList(new ArrayList<>());
        super.getList().add(apiMethodDoc);
    }
}
